package com.gemme.gemme.view;

import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.gemme.gemme.R;
import com.gemme.gemme.gwc.ConfirmOrderActivity;

import java.math.BigDecimal;

public class GwcEditView extends RelativeLayout {
    private Context context;
    public GwcEditView(Context context) {
        this(context,null);
    }

    public GwcEditView(Context context, AttributeSet attrs) {
        this(context, attrs,0);
    }

    public GwcEditView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        this.context = context;
        initView();
    }
    TextView tv_delete;
    LinearLayout ll_no_delete;
    TextView tv_go_confirem;
    TextView sumPrice;
    RoundCheckBox checkbox;
    private void initView() {
        LayoutInflater.from(context).inflate(R.layout.gwc_edit_view,this);
        checkbox = findViewById(R.id.checkbox);
        tv_delete = findViewById(R.id.tv_delete);
        ll_no_delete = findViewById(R.id.ll_no_delete);

        tv_go_confirem = findViewById(R.id.tv_go_confirem);

        sumPrice = findViewById(R.id.sumPrice);
       /* tv_go_confirem.setOnClickListener(new OnClickListener() {
            @Override
            public void onClick(View view) {
                context.startActivity(new Intent(context, ConfirmOrderActivity.class));
            }
        });*/
    }


    public TextView getTv_go_confirem() {
        return tv_go_confirem;
    }

    public void setIsEdit(boolean isEdit){
        if(isEdit){
            tv_delete.setVisibility(VISIBLE);
            ll_no_delete.setVisibility(GONE);
        }else{
            tv_delete.setVisibility(GONE);
            ll_no_delete.setVisibility(VISIBLE);
        }
    }

    public RoundCheckBox getCheckbox() {
        return checkbox;
    }

    public void setSumPrice(BigDecimal sumprice){
        sumPrice.setText(sumprice + "");
//        tv_go_confirem.setText("去结算（"+sumprice+"）");
    }


    public View getDelete(){
        return tv_delete;
    }
}
